import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "@/views/layout/Index.vue";
import Login from "@/views//login/Index.vue";
import Home from "@/views/home/Home.vue";
import Product from "@/views/product/Index.vue";
import List from "@/views/product/list/Index0.vue";
import Category from "@/views/product/category/Index.vue";
import Order from "@/views/order/Index.vue";
import OrderList from "@/views/order/list/Index.vue";
import Collecty from "@/views/order/collect/Index.vue"; 
import Advert from "@/views/advert/Index.vue";
import AdvertList from "@/views/advert/list/Index.vue";

Vue.use(VueRouter);
const routes = [
  {
    path: "/",
    component: Layout,
    children:[
      {
        path: "",
        name: "home",
        component: Home
      },
      {
        path: "/product",
        name: "product" ,
        component: Product,
        children:[
          {
            path: "list",
            name: "list",
            component: List,
          },
          {
            path: "category",
            name: "category",
            component: Category,
          }
        ]
      },
      {
        path: "add-product", //商品添加--编辑-查看  /product/product-page
        name: "ProductPage",
        component: AddProduct,
        meta: {
          //配置高亮标识
          // activeMenu: "/product/list",//获取path
          activeMenu: "list",//获取name
          title: "添加商品",
        },
      },
      {
        path: "/order",
        name: "order" ,
        component: Order,
        children:[
          {
            path: "orderlist",
            name: "orderlist",
            component: OrderList,
          },
          {
            path: "collect",
            name: "collect",
            component: Collecty,
          }
        ]
      },
      {
        path: "/advert",
        name: "advert" ,
        component: Advert,
        children:[
          {
            path: "advertlist",
            name: "advertlist",
            component: AdvertList,
          }
        ],
      }
    ]
  },
  {
    path: "/login",
    name: "login",
    component: Login,
  },
  
];
const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
